package pers.mingshan.thread.thread.producerconsumer;

/**
 * 生产者
 * 
 * @author mingshan
 *
 */
public class Producer implements Runnable {
    private EventStorage eventStorage;

    public Producer(EventStorage eventStorage) {
        this.eventStorage = eventStorage;
    }

    @Override
    public void run() {
        System.out.println("生产者开始生产产品");
        while(true) {
            try {
              Thread.sleep(1000);
            } catch (Exception e) {
                e.printStackTrace();
            }
            eventStorage.set();
        }
    }

}
